{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Structure of NLP neural networks"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "本文将基于 pytorch进行数据实验"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# RNN\n",
    "## 变长序列如何处理\n",
    "### \"PAD\" \n",
    "\n",
    "<a href='https://postimg.cc/ph8qJfgR' target='_blank'><img src='https://i.postimg.cc/JnYvmKxD/image.png' border='0' alt='image'/></a>\n",
    "\n",
    "RNN 的基本结构\n",
    "\n",
    "\n",
    "\n",
    "> As an example, you can create buckets of sentences of the same size, pad them with the necessary amount of zeros, or placeholders which stand for zero word and afterwards feed them along with seq_length = len(zero_words).\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 为什么要进行PAD \n",
    "\n",
    "Deep learning libraries assume a vectorized representation of your data.\n",
    "\n",
    "In the case of variable length sequence prediction problems, this requires that your data be transformed such that each sequence has the same length.\n",
    "\n",
    "This vectorization allows code to efficiently perform the matrix operations in batch for your chosen deep learning algorithms.\n",
    "\n",
    "> 'pad' means filling the spaces with speciified value.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "file_extension": ".py",
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  },
  "mimetype": "text/x-python",
  "name": "python",
  "npconvert_exporter": "python",
  "pygments_lexer": "ipython3",
  "version": 3
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
